'''
Created on 11 Jul 2013

@author: Matt
'''
from MattCrypto.CryptoFunctions import hash_file_in_blocks, hexStrToBits, xor,\
    bitsToHex

if __name__ == '__main__':
    print(hash_file_in_blocks(1024, "6 - 2 - Generic birthday attack (16 min).mp4"))
    print(hash_file_in_blocks(1024, "6 - 1 - Introduction (11 min).mp4"))
    
    cipherBits = hexStrToBits("354e3663d6d79fd6830f107bc0514df6")
    negateBits = hexStrToBits("ffffffffffffffffffffffffffffffff")
    negatedBits = xor(cipherBits, negateBits)
    print(bitsToHex(cipherBits))
    print(bitsToHex(negateBits))
    print(bitsToHex(negatedBits))
    
    eOfx1 = hexStrToBits("78498cde07d82a92b6a07efa970a854d")
    eOfx2 = hexStrToBits("ff5afe64213e5e63f6042b1dc08d27f6")
    y2XorY1 = xor(eOfx1, eOfx2)
    y1 = hexStrToBits("ffffffffffffffffffffffffffffffff")
    y2 = xor(y2XorY1, y1)
    print(bitsToHex(y2))